package com.lzq.mq.nameserver.store;

import io.netty.channel.ChannelHandlerContext;
import lombok.Getter;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
 *
 */
public class ReplicationChannelManager {

    /**
     * 存储需要同步的子节点
     * channelId -> channel
     */
    @Getter
    private Map<String, ChannelHandlerContext> validSlaveChannelMap = new ConcurrentHashMap<>();

    public Map<String, ChannelHandlerContext> getChannelHandlerContextMap() {
        return validSlaveChannelMap;
    }

    public void put(String reqId, ChannelHandlerContext channelHandlerContext) {
        validSlaveChannelMap.put(reqId, channelHandlerContext);
    }

    public void get(String reqId) {
        validSlaveChannelMap.get(reqId);
    }
}